<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pm="http://primefaces.org/mobile"
	template="/templates/mobileTemplate.xhtml">

	<f:metadata>
		<f:event type="preRenderView"
			listener="#{advogadoMobileBean.criar}" />
	</f:metadata>
	
	<ui:define name="content">
	
		<pm:view id="cadastro">
			<pm:header
				title="#{msg['label.aplicacao.nome']}" />
			<pm:content>
				<div align="center">
					<h3>#{msg['botao.cadastre-se']}</h3>
				</div>
				<h:form id="cadastroAdvogadoForm">
					<p:messages />
				
					<p:inputText value="#{advogadoMobileBean.entidade.nome}" id="nome" label="#{msg['advogado.nome']}" />
					<p:message for="nome" />
					<p:inputText value="#{advogadoMobileBean.entidade.cpf}" id="cpf" label="#{msg['advogado.cpf']}" maxlength="11" />
					<p:message for="cpf" />
					<p:inputText value="#{advogadoMobileBean.entidade.numeroOab}" id="numeroOab" label="#{msg['advogado.numeroOab']}" maxlength="7" />
					<p:message for="numeroOab" />
					<h:selectOneMenu value="#{advogadoMobileBean.entidade.ufOab}" id="ufOab"
						converter="viewMapEntityConverter" var="sItem">
						<f:selectItem itemLabel="#{msg['advogado.ufOab.selecione']}"/>
						<f:selectItems value="#{advogadoMobileBean.ufs}" var="uf" 
							itemLabel="#{uf.sigla}" itemValue="#{uf}" />
					</h:selectOneMenu>
					<p:message for="ufOab" />
					<p:inputText value="#{advogadoMobileBean.entidade.tipoOab}" id="tipoOab" label="#{msg['advogado.tipoOab']}" maxlength="1" />
					<p:message for="tipoOab" />
					<p:separator />
					<h4>#{msg['advogado.dadosAcesso']}</h4>
					<p:separator />
					<p:inputText value="#{advogadoMobileBean.usuario.email}" id="email" label="#{msg['usuario.email']}" maxlength="255" />
					<p:message for="email" />
					<p:inputText value="#{advogadoMobileBean.usuario.senha}" id="senha" label="#{msg['usuario.senha']}" type="password" maxlength="30" />
					<p:message for="senha" />
					<p:inputText value="#{advogadoMobileBean.usuario.confirmaSenha}" id="confirmaSenha" label="#{msg['usuario.confirmaSenha']}" type="password" maxlength="30" />
					<p:message for="confirmaSenha" />

					<p:commandButton value="#{msg['botao.salvar']}"
						action="#{advogadoMobileBean.salvar}" icon="check" update="cadastroAdvogadoForm" oncomplete="$('html, body').animate({ scrollTop: 0 }, 'slow')" />
					<p:button value="#{msg['botao.cancelar']}" icon="delete" outcome="/index" />
				</h:form>
			</pm:content>
		</pm:view>
		
		<pm:view id="cadastroSucesso">
			<pm:header title="#{msg['label.aplicacao.nome']}">
                <f:facet name="left"><p:button value="#{msg['botao.voltar']}" icon="back" outcome="/index" /></f:facet>
            </pm:header>
			<pm:content>
				<h3>#{msg['label.bemVindo']}</h3>
				<h4>#{msg['advogado.mensagem.cadastroEfetuado']}</h4>
				<h4>#{msg['advogado.mensagem.confirmacaoEmail']}</h4>				
			</pm:content>
		</pm:view>
	</ui:define>
</ui:composition>